<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateExchangesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('exchanges', function (Blueprint $table) {
            $table->bigIncrements('id')->comment('兑换ID');
            $table->unsignedInteger('user_id')->comment('用户ID');
            $table->decimal('usdt_number', 20, 8)->comment('USDT数量');
            $table->unsignedDecimal('rate', 20, 8)->comment('兑换汇率');
            $table->decimal('bp_number', 20, 8)->comment('BP数量');
            $table->timestamp('time')->nullable()->useCurrent()->comment('时间');

            $table->index('user_id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('exchanges');
    }
}
